package com.tinyideatech.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tinyideatech.system.entity.SysUser;
import com.tinyideatech.system.entity.SysUserRole;
import com.tinyideatech.system.mapper.SysUserMapper;
import com.tinyideatech.system.mapper.SysUserRoleMapper;
import com.tinyideatech.system.service.ISysUserRoleService;
import com.tinyideatech.system.service.ISysUserService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements ISysUserRoleService {

    @Override
    public void removeUserRole(SysUser user) {
        QueryWrapper<SysUserRole> qw = new QueryWrapper<>();
        qw.eq("user_id", user.getUserId());
        if(super.count(qw) > 0){
            super.remove(qw);
        }
    }
}
